package model;

import java.io.Serializable;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@NamedQueries( { @NamedQuery(name = "JefeTaller.findAll", query = "select o from JefeTaller o") })
@Table(name = "JEFE_TALLER")
public class JefeTaller implements Serializable {
    @Column(name = "PASSWORD_JT", nullable = false, length = 20)
    private String passwordJt;
    @Id
    @Column(name = "RUT_JT", nullable = false, length = 10, insertable = false, updatable = false)
    private String rutJt;
    @ManyToOne
    @JoinColumn(name = "RUT_JT")
    private Personal personal;
    @ManyToOne
    @JoinColumn(name = "ID_TALLER")
    private Taller taller;

    public JefeTaller() {
    }

    public JefeTaller(Taller taller, String passwordJt, Personal personal) {
        this.taller = taller;
        this.passwordJt = passwordJt;
        this.personal = personal;
    }


    public String getPasswordJt() {
        return passwordJt;
    }

    public void setPasswordJt(String passwordJt) {
        this.passwordJt = passwordJt;
    }

    public String getRutJt() {
        return rutJt;
    }

    public void setRutJt(String rutJt) {
        this.rutJt = rutJt;
    }

    public Personal getPersonal() {
        return personal;
    }

    public void setPersonal(Personal personal) {
        this.personal = personal;
        if (personal != null) {
            this.rutJt = personal.getRut();
        }
    }

    public Taller getTaller() {
        return taller;
    }

    public void setTaller(Taller taller) {
        this.taller = taller;
    }
}
